package com.personal.cuncunxing.module.home.pojo;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.asm.Type;

import java.util.List;

/**
 * Description:
 * Created by kode on 2020/5/28.
 */
public class ContactBeanConvert<T> {

    //String TO JavaBean
    public <T> List<T> convertToEntityProperty(String databaseValue, Class<T> object) {
        return JSON.parseArray(databaseValue, object);
    }

    //JavaBean TO String
    public String convertToDatabaseValue(List<T> entityProperty) {
        return JSON.toJSONString(entityProperty);
    }

    private static class HolderClass {
        private final static ContactBeanConvert instance = new ContactBeanConvert();
    }

    public static ContactBeanConvert getInstance() {
        return HolderClass.instance;
    }
}
